(function(window, angular, undefined){

	var Module = angular.module('water.entity.district',['waterCommon']);
	
	Module.service('$districtService',function($waterDataCommon){
		
		/**
		 * 获取政区数据
		 */
		this.getDistrict = function(){
			var promise = $waterDataCommon.post("/district/getDistrict");
			return promise;
		}
		
		/**
		 * 获取政区数据，提供给com select 组件使用
		 */
		this.getDistrictDomain = function(){
			var promise = $waterDataCommon.post("/district/getDistrict").then(function(data){
				for(var i=0;i<data.qu.length;i++){
					data.qu[i].v=data.qu[i].NAME;
					data.qu[i].k=data.qu[i].CODE;
				}
				return data;
			});
			return promise;
		}
		
	})
}(window, angular));